package com.wqi5.chapter8;

public class ToyTest {

	public static void main(String[] args) {
		Class c = null;
		try{
			c = Class.forName("com.wqi5.chapter8.FancyToy");
		}catch(ClassNotFoundException e){
			
		}
		printInfo(c);
		Class[] faces = c.getInterfaces();
		for(int i=0;i<faces.length;i++){
			printInfo(faces[i]);
		}
		Class cy = c.getSuperclass();
		printInfo(cy);
		Object o = null;
		try{
			o = cy.newInstance();
		}catch(Exception e){
			e.printStackTrace();
		}
		printInfo(o.getClass());
	}
	
	static void printInfo(Class cs){
		System.out.println("Class Name:" + cs.getName() + " is Interface? ["+
				cs.isInterface()+"]");
	}
}

interface HasBatteries{}
interface Waterprof{}
interface ShootsThings{}
class Toy{
	Toy(){}
	Toy(int i){}
}
class FancyToy extends Toy implements HasBatteries,Waterprof,ShootsThings{
	public FancyToy() {
	
	}
}

